From: Gilles MassonMessage-Id: <199603270858.JAA01854@ogpsrv.unice.fr> X-Authentication-Warning: ogpsrv.unice.fr: Host localhost didn't use HELO protocol X-Mailer: exmh version 1.6.5 12/11/95 To: mui@sunsite.Informatik.RWTH-Aachen.DE Subject: Re: AutoDocs In-Reply-To: Your message of "Tue, 26 Mar 96 16:59:15 GMT." <9603261659.AA08422@cam-ani.co.uk> Mime-Version: 1.0 Date: Wed, 27 Mar 96 09:57:57 +0100 X-Mts: smtp Resent-Message-Id: <"Y5EjK1.0.6G5.EEGMn"@sunsite> Resent-From: mui@sunsite.Informatik.RWTH-Aachen.DE Reply-To: mui@sunsite.Informatik.RWTH-Aachen.DE X-Mailing-List: archive/latest/805 X-Loop: mui@sunsite.informatik.rwth-aachen.de Precedence: list Resent-Sender: mui-request@sunsite.Informatik.RWTH-Aachen.DE X-Lines: 178 Status: RO Content-Type: text/plain; charset="us-ascii" Content-Length: 4634 Some inlines are missing in inline/muimaster.h !!! Here are changes i have done some time ago (i done it by hand and test only few of them, so be carreful) There are at least usefull with gcc, don't know for others. ------------------------------------------------------- /* NOT SURE OF THESE ONES !!! */ __inline APTR MUI_AddClipping( BASE_PAR_DECL struct MUI_RenderInfo *mri, WORD left,WORD top,WORD width,WORD h eight) { BASE_EXT_DECL register APTR res __asm("d0"); register struct Library* a6 __asm("a6") = BASE_NAME; register struct MUI_RenderInfo* a0 __asm("a0") = mri; register WORD d0 __asm("d0") = left; register WORD d1 __asm("d1") = top; register WORD d2 __asm("d2") = width; register WORD d3 __asm("d3") = height; __asm volatile (" jsr a6@(-0xa8)" : "=r" (res) : "r" (a6), "r" (a0), "r" (d0), "r" (d1), "r" (d2), "r" (d3) : "d0", "d1", "d2", "d3", "a0", "a1" ); return res; } __inline void MUI_RemoveClipping( BASE_PAR_DECL struct MUI_RenderInfo *mri, APTR handle) { BASE_EXT_DECL register res __asm("d0"); register struct Library* a6 __asm("a6") = BASE_NAME; register struct MUI_RenderInfo* a0 __asm("a0") = mri; register APTR a1 __asm("a1") = handle; __asm volatile (" jsr a6@(-0xae)" : "=r" (res) : "r" (a6), "r" (a0), "r" (a1) : "d0", "d1", "a0", "a1" ); } __inline APTR MUI_AddClipRegion( BASE_PAR_DECL struct MUI_RenderInfo *mri, struct Region *r) { BASE_EXT_DECL register APTR res __asm("d0"); register struct Library* a6 __asm("a6") = BASE_NAME; register struct MUI_RenderInfo* a0 __asm("a0") = mri; register struct Region * a1 __asm("a1") = r; __asm volatile (" jsr a6@(-0xb4)" : "=r" (res) : "r" (a6), "r" (a0), "r" (a1) : "d0", "d1", "a0", "a1" ); return res; } __inline void MUI_RemoveClipRegion( BASE_PAR_DECL struct MUI_RenderInfo *mri, APTR handle) { BASE_EXT_DECL register res __asm("d0"); register struct Library* a6 __asm("a6") = BASE_NAME; register struct MUI_RenderInfo* a0 __asm("a0") = mri; register APTR a1 __asm("a1") = handle; __asm volatile (" jsr a6@(-0xba)" : "=r" (res) : "r" (a6), "r" (a0), "r" (a1) : "d0", "d1", "a0", "a1" ); } __inline BOOL MUI_BeginRefresh( BASE_PAR_DECL struct MUI_RenderInfo *mri, ULONG flags) { BASE_EXT_DECL register BOOL res __asm("d0"); register struct Library* a6 __asm("a6") = BASE_NAME; register struct MUI_RenderInfo* a0 __asm("a0") = mri; register ULONG d0 __asm("d0") = flags; __asm volatile (" jsr a6@(-0xc0)" : "=r" (res) : "r" (a6), "r" (a0), "r" (d0) : "d0", "d1", "a0", "a1" ); return res; } __inline void MUI_EndRefresh( BASE_PAR_DECL struct MUI_RenderInfo *mri, ULONG flags) { BASE_EXT_DECL register res __asm("d0"); register struct Library* a6 __asm("a6") = BASE_NAME; register struct MUI_RenderInfo* a0 __asm("a0") = mri; register ULONG d0 __asm("d0") = flags; __asm volatile (" jsr a6@(-0xc6)" : "=r" (res) : "r" (a6), "r" (a0), "r" (d0) : "d0", "d1", "a0", "a1" ); } __inline LONG MUI_ObtainPen( BASE_PAR_DECL struct MUI_RenderInfo *mri, struct MUI_PenSpec *spec,ULONG flags) { BASE_EXT_DECL register LONG res __asm("d0"); register struct Library* a6 __asm("a6") = BASE_NAME; register struct MUI_RenderInfo* a0 __asm("a0") = mri; register struct MUI_PenSpec * a1 __asm("a1") = spec; register ULONG d0 __asm("d0") = flags; __asm volatile (" jsr a6@(-0x9c)" : "=r" (res) : "r" (a6), "r" (a0), "r" (a1), "r" (d0) : "d0", "d1", "a0", "a1" ); return res; } __inline void MUI_ReleasePen( BASE_PAR_DECL struct MUI_RenderInfo *mri, LONG pen) { BASE_EXT_DECL register res __asm("d0"); register struct Library* a6 __asm("a6") = BASE_NAME; register struct MUI_RenderInfo* a0 __asm("a0") = mri; register LONG d0 __asm("d0") = pen; __asm volatile (" jsr a6@(-0xa2)" : "=r" (res) : "r" (a6), "r" (a0), "r" (d0) : "d0", "d1", "a0", "a1" ); } __inline BOOL MUI_Layout( BASE_PAR_DECL Object *obj,LONG left,LONG top,LONG width,LONG height,ULONG flags) { BASE_EXT_DECL register BOOL res __asm("d0"); register struct Library* a6 __asm("a6") = BASE_NAME; register Object * a0 __asm("a0") = obj; register LONG d0 __asm("d0") = left; register LONG d1 __asm("d1") = top; register LONG d2 __asm("d2") = width; register LONG d3 __asm("d3") = height; register ULONG d4 __asm("d4") = flags; __asm volatile (" jsr a6@(-0x7e)" : "=r" (res) : "r" (a6), "r" (a0), "r" (d0), "r" (d1), "r" (d2), "r" (d3), "r" (d4) : "d0", "d1", "d2", "d3", "d4", "a0", "a1" ); return res; } ------------------------------------------------------- Gilles MASSON From: Willi <101526.3324@CompuServe.COM> Subject: RE: mcc class with gcc To: mui@sunsite.Informatik.RWTH-Aachen.DE Message-Id: <960506130711_101526.3324_IHK73-2@CompuServe.COM> Content-Transfer-Encoding: 7BIT Resent-Message-Id: <"6-NDL3.0.Kv.2HWZn"@sunsite> Resent-From: mui@sunsite.Informatik.RWTH-Aachen.DE Reply-To: mui@sunsite.Informatik.RWTH-Aachen.DE X-Mailing-List: archive/latest/1215 X-Loop: mui@sunsite.informatik.rwth-aachen.de Precedence: list Resent-Sender: mui-request@sunsite.Informatik.RWTH-Aachen.DE Content-Type: text Content-Length: 3032 X-Lines: 81 Status: RO > Hi, > > Is there anyone who have tried (and succeeded) to make > a mcc custom class with gcc ? Hi Gilles, Yes, there is no problem to make a !! private !! mcc_CustomClass with gcc. I have not tried to make public custom classes with gcc, but this should work too, I think. There are many (at least three) approaches to create custom classes with gcc. a) One Method is to use the old MUI_GetClass(), MakeClass(), and NewObject() calls, and setting up the Hook "by Hand". Study the programmer Manual to see how this works. But I think you want to use the (rather) new MUI_CreateCustomClass() call. b) To make the Class1.c example work with noixemul package you have to: - delete or define out all the SAVEDS, ASM and REG() keywords. - add #include - replace the MUI_CreateCustomClass() call with: mcc = MUI_CreateCustomClass(NULL,MUIC_Area,NULL, sizeof(struct MyData), MyDispatcher); if(mcc) { mcc->mcc_Class->cl_Dispatcher.h_Entry = &HookEntry; } else { fail(NULL,"Could not create custom class."); } - compile with: gcc Class1.c -noixemul -o Class1 (do not mind the warnings!) c) If you do not use noixemul you probably have to provide HookEntry yourself in assembler: /* HookEntry() is in AmigaLib (sometimes!)*/ asm(" .even .globl _HookEntry _HookEntry: move.l a1,-(sp) | push message packet pointer move.l a2,-(sp) | push object pointer move.l a0,-(sp) | push hook pointer move.l 12(a0),a0 | fetch C entry point ... (h_SubEntry) jsr (a0) | ... and call it lea 12(sp),sp | fix stack rts "); My Estimation is you have problems to create the dispatcher Hook for the class, since this is a little bit tricky with gcc. (And not absolutely portable). The code above contains a little trick with the Hook structure. I had recently a private mail discussion with Stefan about this stuff. Since this was in german, I write here the essentials in english: The basic Idea of how Hooks work, is written in . MUI_CreateCustomClass() puts the dispatcher pointer in Hook.h_SubEntry and sets the Hook.h_Entry to a routine which initializes a5 and a6 registers, as noted in Autodocs of MUI_CreateCustomClass(). Since we do not need the registers initialized, we set Hook.h_Entry to our HookEntry() function which calls the HLL Hook.h_SubEntry. But here we have the Problem: This will work only as long as Stefan does not change the initialisation routine of MUI_CreateCustomClass(). Question: Does someone have a better solution here? (Or can we rely on the present implementation? Stefan?) I suggest you use the noixemul environment for MUI-development with gcc. You can find it on Aminet and on Fish CD's. I got mine from Fish, where it is preinstalled. Drop me a mail if you want to have some Example Code. Or should I send the example code over the newsgroup? Greetings Willi... (Burkhardt - not Willhelmi) From: Gilles MASSON To: mui@sunsite.Informatik.RWTH-Aachen.DE Cc: masson@ogpsrv.unice.fr Subject: Re: mcc class with gcc In-Reply-To: Your message of "Mon, 06 May 96 09:07:11 EDT." <960506130711_101526.3324_IHK73-2@CompuServe.COM> Mime-Version: 1.0 Date: Mon, 06 May 96 17:03:06 +0200 Sender: masson@iut-soph.unice.fr X-Mts: smtp Resent-Message-Id: <"g8mAn1.0.x82.rNXZn"@sunsite> Resent-From: mui@sunsite.Informatik.RWTH-Aachen.DE Reply-To: mui@sunsite.Informatik.RWTH-Aachen.DE X-Mailing-List: archive/latest/1216 X-Loop: mui@sunsite.informatik.rwth-aachen.de Precedence: list Resent-Sender: mui-request@sunsite.Informatik.RWTH-Aachen.DE X-Lines: 90 Status: RO Content-Type: text/plain; charset="us-ascii" Content-Length: 2799 > Hi Gilles, > > Yes, there is no problem to make a !! private !! mcc_CustomClass > with gcc. I have not tried to make public custom classes with gcc, > but this should work too, I think. I allready known how to do PRIVATE custom class, i asked for PUBLIC... > - delete or define out all the SAVEDS, ASM and REG() keywords. ok > - add #include ok > - replace the MUI_CreateCustomClass() call with: > mcc = MUI_CreateCustomClass(NULL,MUIC_Area,NULL, > sizeof(struct MyData), > MyDispatcher); > if(mcc) > { > mcc->mcc_Class->cl_Dispatcher.h_Entry = &HookEntry; > } > else > { > fail(NULL,"Could not create custom class."); > } why change that ? (see below) > - compile with: > gcc Class1.c -noixemul -o Class1 > (do not mind the warnings!) i don't get any warnings in my private custom classes. > > > My Estimation is you have problems to create the dispatcher Hook > for the class, since this is a little bit tricky with gcc. (And not > absolutely portable). i don't have any problems with hooks. (see below) > The code above contains a little trick with the Hook structure. I had > recently a private mail discussion with Stefan about this stuff. Since > this was in german, I write here the essentials in english: > The basic Idea of how Hooks work, is written in . > MUI_CreateCustomClass() puts the dispatcher pointer in Hook.h_SubEntry > and sets the Hook.h_Entry to a routine which initializes a5 and a6 > registers, as noted in Autodocs of MUI_CreateCustomClass(). Since we > do not need the registers initialized, we set Hook.h_Entry to our > HookEntry() function which calls the HLL Hook.h_SubEntry. > > But here we have the Problem: This will work only as long as Stefan > does not change the initialisation routine of MUI_CreateCustomClass(). > Question: Does someone have a better solution here? (Or can we rely on > the present implementation? Stefan?) I don't understand why you do so complicated thing ! You can do hooks with the standard mui calls to them (by registers). All is to make a function without args (void) and set params after (look in the gcc faq, i found it there). I do that : /* SAVEDS ASM ULONG DXL_Dispatcher(REG(a0) struct IClass *cl,REG(a2) Object *obj,REG(a1) Msg msg)*/ static ULONG DXL_Dispatcher(void) { register struct IClass *a0 __asm("a0"); struct IClass *cl = a0; register Object *a2 __asm("a2"); Object *obj = a2; register Msg a1 __asm("a1"); Msg msg = a1; ..... ..... } ..... DXListClass = MUI_CreateCustomClass(NULL,MUIC_Area,NULL, sizeof(struct DXLData),(APTR) DXL_Dispatcher); ..... and it's work fine ! (i use it in: ftp://bibliut.unice.fr/amiga/mui/MUI_NewList.lha) Gilles MASSON Subject: RE: public mcc class with gcc Message-Id: <960517172457_101526.3324_IHK58-1@CompuServe.COM> Resent-Message-Id: <"i8r1J1.0.h44.aSBdn"@sunsite> Resent-From: mui@sunsite.Informatik.RWTH-Aachen.DE Reply-To: mui@sunsite.Informatik.RWTH-Aachen.DE X-Mailing-List: archive/latest/1334 X-Loop: mui@sunsite.informatik.rwth-aachen.de Precedence: list Resent-Sender: mui-request@sunsite.Informatik.RWTH-Aachen.DE Content-Type: text Content-Length: 1804 X-Lines: 52 Status: RO Hi Gilles, After hours of trying, I finally did it! I did the MCC UserData Example with gcc. I have used the library code of the libnix-package. The only real Problem was the register a4. (Dataspace) for __UserDataInit() and __UserDataCleanup() there was no need to deal with a4. And for MCC_GetClass() the a4 stuff is in the ADDTABL defines. The only Problem was the Dispatcher. It works if you add following Assembler code: asm(".globl _Dispatcher "); asm("_Dispatcher: movel a4,sp@- "); asm(" movel a6@(40:W),a4 "); asm(" bsr __Dispatcher "); asm(" movel sp@+,a4 "); asm(" rts "); The rest of the code needs no big change! Only externals and those ADDTABLS(). The makefile needs the following change: gcc -V 2.3.3 -nostdlib -O3 -fbaserel $^ -o $@ -L local:lib/libnix \ -lamiga -lstubs If someone is interested in the original code, I'm able to mail it. ------------ [citation] > I don't understand why you do so complicated thing ! > You can do hooks with the standard mui calls to them (by registers). > All is to make a function without args (void) and set params after > (look in the gcc faq, i found it there). > > I do that : > > /* SAVEDS ASM ULONG DXL_Dispatcher(REG(a0) struct IClass *cl,REG(a2) Object > *obj,REG(a1) Msg msg)*/ > static ULONG DXL_Dispatcher(void) > { > register struct IClass *a0 __asm("a0"); struct IClass *cl = a0; > register Object *a2 __asm("a2"); Object *obj = a2; > register Msg a1 __asm("a1"); Msg msg = a1; > ..... > ..... > } many thanks for this regargs trick. My (complicated) way follows the documen- tation in ... Willi Burkhardt 101526,3324@compuserve.com Subject: Re: public mcc class with gcc In-Reply-To: Your message of "17 May 96 13:24:58 EDT." <960517172457_101526.3324_IHK58-1@CompuServe.COM> Mime-Version: 1.0 Date: Mon, 20 May 96 13:44:46 +0200 Sender: masson@iut-soph.unice.fr X-Mts: smtp Resent-Message-Id: <"-q9Qs2.0.d7.dl5en"@sunsite> Resent-From: mui@sunsite.Informatik.RWTH-Aachen.DE Reply-To: mui@sunsite.Informatik.RWTH-Aachen.DE X-Mailing-List: archive/latest/1367 X-Loop: mui@sunsite.informatik.rwth-aachen.de Precedence: list Resent-Sender: mui-request@sunsite.Informatik.RWTH-Aachen.DE X-Lines: 28 Status: RO Content-Type: text/plain; charset="us-ascii" Content-Length: 1022 > Hi Gilles, > > After hours of trying, I finally did it! > > I did the MCC UserData Example with gcc. I have used the library code of > the libnix-package. The only real Problem was the register a4. (Dataspace) > > for __UserDataInit() and __UserDataCleanup() there was no need to deal with > a4. And for MCC_GetClass() the a4 stuff is in the ADDTABL defines. The only > Problem was the Dispatcher. It works if you add following Assembler code: > [....] > If someone is interested in the original code, I'm able to mail it. I didn't succeed to use the libinit.o startup code of libnix to make mcc. Could you put that on ftp://bibliut.unice.fr/incoming/ please ? (and mail me when done) Anyway, i have done changes to libinit.c and mccheader.c (from kmel) and succeed to make a non baserel stuff for mcc/mcp with gcc, so you don't have to deal with a4 and it's easier (code is bigger and slower anyway of course) and it's work well. you can get it on ftp://bibliut.unice.fr/amiga/mui/gcc_mcc10.lha Gilles MASSON